package com.yootk.producer.service.impl;

import com.yootk.common.Dept;
import com.yootk.producer.service.IMessage;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Service;

@Service
@PropertySource("classpath:config/amqp.properties")
public class MessageServiceImpl implements IMessage {
    @Value("${amqp.rabbitmq.routing.key}")
    private String routingKey ;
    @Autowired
    private AmqpTemplate template ;
    @Override
    public void send(Dept dept)
    {
        this.template.convertAndSend(this.routingKey,dept);
    }
}
